<template>
    <div class="mainDiv">
        <mt-cell>
          <div slot="title">
            {{$root.year}}年全国高校招计计划：在<b  style="margin-left: 15px;">浙江</b>
          </div>
        </mt-cell>
        <div class="box-shadow bg-white">
          <div class="phead pad5"><b class="mr10">{{total.totalSchool}}</b>所学校</div>
          <div class="phead pad5"><b class="mr10">{{total.totalMajor}}</b>个专业</div>
          <div class="phead pad5"><b class="mr10">{{total.totalPeople}}</b>个招生计划</div>
        </div>
        <div class="line"></div>
      <mt-cell >
        <div slot="title">
          您的选考科目为：<b v-for="subject in userInfo.subjects" style="margin-right: 15px;">{{subject}}</b>
        </div>
      </mt-cell>
      <div class="line"></div>
      <mt-cell class=" border-bot" title="相应的范围有："></mt-cell>
      <div class="">
        <mt-cell class=" border-bot h60">
          <div slot="title">
            <!-- <span>学校<b>{{majorFit.totalSchool}}</b>所</span>
            <mt-progress :value="schoolRate" :bar-height="5">
              <div slot="end">{{schoolRate.toFixed(2)}}%</div>
            </mt-progress> -->
            <div class="col-12">
             <div class="col-tit">学校</div>
             <div  class="col-txt">占比{{schoolRate.toFixed(2)}}%</div>
            </div>
            <div class="col-12 col-num">
              {{majorFit.totalSchool}}所
            </div>
          </div>
        </mt-cell>
        <mt-cell class=" border-bot h60">
          <div slot="title">
            <!-- <span>专业<b>{{majorFit.totalMajor}}</b>个</span>
            <mt-progress :value="majorRate" :bar-height="5">
              <div slot="end">{{majorRate.toFixed(2)}}%</div>
            </mt-progress> -->
            <div class="col-12">
             <div class="col-tit">专业</div>
             <div  class="col-txt">占比{{majorRate.toFixed(2)}}%</div>
            </div>
            <div class="col-12 col-num">
              {{majorFit.totalMajor}}个
            </div>
          </div>
        </mt-cell>
        <mt-cell class="h60">
          <div slot="title">
            <!-- <span>招生计划<b>{{majorFit.totalPeople}}</b>个</span>
            <mt-progress :value="peopleRate" :bar-height="5">
              <div slot="end">{{peopleRate.toFixed(2)}}%</div>
            </mt-progress> -->
             <div class="col-12">
             <div class="col-tit">招生计划</div>
             <div  class="col-txt">占比{{peopleRate.toFixed(2)}}%</div>
            </div>
            <div class="col-12 col-num">
              {{majorFit.totalPeople}}个
            </div>
          </div>
        </mt-cell>
      </div>
      <div class="padlr10">
        <mt-button size="large" type="primary" @click="$router.push('/student/phase')">下一步</mt-button>
      </div>
    </div>
</template>

<script>
    export default {
        name: "overview",
        data() {
        return {
           userInfo:{},
           total:{totalPeople:1,totalMajor:1,totalSchool:1}
          ,majorFit:{totalPeople:1,totalMajor:1,totalSchool:1}
         }
       },
       computed:{
          schoolRate:function(){return this.majorFit.totalSchool*100/this.total.totalSchool},
          majorRate:function(){return this.majorFit.totalMajor*100/this.total.totalMajor},
          peopleRate:function(){return this.majorFit.totalPeople*100/this.total.totalPeople},
       },
        created(){
          let vm = this;
           // this.$parent.selected = 'student/overview'
           // window.localStorage.setItem('navTabIndex','student/overview');
          checkLogin(this,function(){
            if(!vm.userInfo ||! vm.userInfo.select_subject){
              //用户未选择自考科目
              vm.$router.push({path:"/student/score"});
            }else {
              vm.$http.get("/auth/overview?year="+vm.$root.year).then(resp2=>{
                vm.total = resp2.data.total;
                vm.majorFit = resp2.data.majorFit;
              })
            }
          })
        }
    }
</script>

<style scoped>
  .mainDiv{
    background: #f7f7f7;
  }
  .Router{
  }
</style>
